global class BatchContactUpsert implements Database.Batchable<sObject>{
String query;

global database.querylocator start(Database.BatchableContext BC){
             query = 'SELECt Id FROM Contact LIMIT 200';
             //query = 'SELECt Id FROM Contact';
            return Database.getQueryLocator(query);
            }

global void execute(Database.BatchableContext BC, List<sObject> scope){
    List<Contact> cons = new List<Contact>();

   for(sObject s : scope){
     Contact a = (Contact)s;
           cons.add(a);
            }
System.debug(cons.size());
upsert(cons);
    
}
global void finish(Database.BatchableContext BC){

  }
}